// src.services.uitl.CoreDataServiceFactory.js

var httpServer = require("./HttpDataService");
var dbServer = require("./DBDataService");
var instance = null;

var CoreDataServiceFactory = function (res, ret) {
    if(!CoreDataServiceFactory){
        return new CoreDataServiceFactory();
    }
    this.getObject=function(type) {
        var dataServer;
        if(type == "DBDataService"){
            dataServer =  new dbServer();
        }
        if(type == "HttpDataService"){
            dataServer = new httpServer();
        }
        return dataServer.queryMap(res, ret);
    }
    this.saveObject=function(type) {
        var dataServer;
        if(type == "HttpDataService"){
            dataServer = new httpServer();
        }else if(type == "DBDataService"){
            dataServer =  new dbServer();
        }
        return dataServer.saveData(res, ret);
    }
};

function DataFactory(options){
    this.options = options;
}

Facroty.prototype.getData = function(options){
    return this.options(options);
}

function create(options){
    return new Factory(options);
}

function CoreDataServiceFactory(){
    this.queryMap();
}

exports.Instance = function() {
    if (instance == null) {
        instance = new CoreDataServiceFactory();
    }
    return instance;
};

var resultmap = CoreDataServiceFactory.instance().queryMap(res,ret);
console.log(resultmap);